package com.pressure.test;

import java.util.Timer;
import java.util.TimerTask;

import com.sls.core.http.HttpClient;

public class MyTimerTask extends TimerTask{
	
	private static Timer timer = null;
	
	private static String result = null;

	@Override
	public void run() {
		HttpClient httpClient = new HttpClient();
		String url = "http://192.168.1.186:8000/api_game/notifyUrl";
		try {

			result = httpClient.doGet(url, "GBK");
			if ("success".equals(result)) {
				timer.cancel();
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	
	/**
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		MyTimerTask myTimerTask = new MyTimerTask();
		timer = new Timer();
		System.out.println("定时器已开始启动...");
		timer.schedule(myTimerTask, 0, 5000);
	}

}
